﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LoadGenerator
{
    interface CommunicationData
    {
        byte[] nextData();
        void received(byte[] data, int len);
    }

    public class ByteData : CommunicationData
    {
        ByteBuffer _dataToSend;
        ByteBuffer _lastresponse;

        public ByteData()
        {
            reset();
        }

        public void reset()
        {
            _dataToSend = new ByteBuffer(100);
            _lastresponse = new ByteBuffer(100);
        }

        public byte[] data { get { return _dataToSend.getData(); }
            set { _dataToSend.Append(value, 0, value.Length); }
        }

        public byte[] nextData() { return _dataToSend.getData(); }
        public void received(byte[] data, int len) { _lastresponse.Append(data, 0, len); }
        public ByteBuffer getLastResponse() { return _lastresponse; }
    }
}
